﻿<!DOCTYPE html>
<html>
<head>
    <title>锐浪HTML5报表演示 - 子报表应用主报表参数</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <script src="../grhtml5-6.6-min.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        var reportViewer;

        function window_onload() {
            reportViewer = rubylong.grhtml5.insertReportViewer("report_holder", "../../grf/4d.grf", "");

            reportViewer.report.OnInitialize = OnInitialize;

            cmbCity_onchange();
        }

        function OnInitialize() {
            var cmbCity = document.getElementById("cmbCity");

            //根据查询参数更新报表中的对应参数值
            reportViewer.report.ParameterByName("City").AsString = cmbCity.value;
        }

        function cmbCity_onchange() {
            var cmbCity = document.getElementById("cmbCity");

            //首先必须停止报表运行，这样报表才能更新生成
            reportViewer.stop();

            //根据当前查询参数设置报表的取数URL
            reportViewer.dataURL = "../../data/DataCenter.jsp?data=SubReport_4d&city=" + encodeURIComponent(cmbCity.value);

            //启动报表运行，生成报表
            reportViewer.start();
        }
    </script>
</head>
<body onload="window_onload()">
    <div>
        <span>主报表参数：</span>
        <select id="cmbCity" style="width: 97px" onchange="return cmbCity_onchange()">
            <option value="北京" selected="selected">北京</option>
            <option value="上海">上海</option>
            <option value="天津">天津</option>
        </select>
    </div>
    <div id="report_holder"></div>
</body>
</html>